function [ ] = plotEmissionsVsHeat( obj, filename, titleString )
% plotEmissionsVsHeat Compare emissions to aggregate heat output
%
% INPUTS:
%   obj : etsModel object

%% Formatting options
textProp = {'fontsize'    , 14, ...
            'FontName'    , 'Times New Roman'};
labProp  = {'fontsize'    , 14, ...
            'FontName'    , textProp{4}};

%% Plot residual demand, own supply and market clearing
f0 = figure;

h1 = scatter(obj.plant.Hi,obj.plant.Eit);
hold on;

xlabel('Heat output',textProp{:},'Interpreter','latex');
ylabel('Emissions (kg)',textProp{:},'Interpreter','latex');

title(titleString,textProp{:},'Interpreter','latex');

% Figure formatting
set(gcf, 'Color'       , 'w' );
set(gca, labProp{:}, ...
         'Box'         , 'off'              , ...
         'LineWidth'   , 1.5                , ...
         'PlotBoxAspectRatio', [1 0.75 0.75]);  

% 45-degree line
% h3 = plot([0,0],[pmin,pmax],'k-','LineWidth',1.5);

% Reset axis limits
xl = xlim;
xmax = xl(2);
xlim([ 0 xmax ]);

yl = ylim;
ymax = yl(2);
ylim([ 0 ymax ]);

hold off;

%% Export figure

% Crop whitespace 
fig = gcf;
fig.PaperPositionMode = 'auto';
fig_pos = fig.PaperPosition;
fig.PaperSize = [fig_pos(3) fig_pos(4)];

ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) - ti(1) - ti(3);
ax_height = outerpos(4) - ti(2) - ti(4);
ax.Position = [left bottom ax_width ax_height];

fprintf(1,'Writing %s to file ...\n',filename);
print(f0,'-dpdf','-painters','-noui','-r600',filename);
fprintf(1,' complete.\n');

end